package com.hairline.hairlinemarket.service.impl;

import com.hairline.hairlinemarket.bean.MarketComment;
import com.hairline.hairlinemarket.bean.MarketCommentExample;
import com.hairline.hairlinemarket.mapper.MarketCommentMapper;
import com.hairline.hairlinemarket.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Author:杨小凯
 * Date:2023-04-21 7:24
 * Description:<描述>
 */
@Service
public class CommentServiceImpl implements CommentService {

    @Autowired
    private MarketCommentMapper commentMapper;
    @Override
    public Map queryByGoodsId(Integer id) {
        MarketCommentExample commentExample = new MarketCommentExample();
        MarketCommentExample.Criteria criteria = commentExample.createCriteria();
        criteria.andValueIdEqualTo(id);
        List<MarketComment> marketComments = commentMapper.selectByExample(commentExample);
        Map<List<MarketComment>, Integer> map = new HashMap<>();
        map.put(marketComments, marketComments.size());
        return map;
    }
}
